I end up getting this error --------
| … $response = Invoke-RestMethod -Uri $URL -Method POST -Headers $header …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"error":"Not authorized to run response plays"}
When using the Response Play API below. I am a bit confused as to why this is failing because my APIAccessKey works with the other endpoints? Any help would be greatly appreciated form Support or the Development community.
$URL = 'https://api.pagerduty.com/response_plays/ResponsePlayJsonID/run'
function Start-ResponsePlay {
$headers=@{}
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/vnd.pagerduty+json;version=2")
$headers.Add("From", "me.com")
$headers.Add("Authorization", "Token token=APIAccessKey")
$response = Invoke-RestMethod -Uri $URL -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"incident": {
"id": "Random",
"type": "incident_reference"
}
}'
return $response
}
Start-ResponsePlay